<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="ContratoEditDlg" widgetVar="ContratoEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditContratoTitle}" >
            <h:form id="ContratoEditForm" >
                <p:tab title="Dados do Contrato">
                    <h:panelGroup id="display">
                        <p:panelGrid columns="1" rendered="#{contratoController.selected != null}">
                            <p:row>
                                <p:column>
                                    <p:outputLabel value="#{bundle.CreateContratoLabel_nuContrato}" for="nuContrato" />
                                    <p:inputText id="nuContrato" value="#{contratoController.selected.nuContrato}" title="#{bundle.CreateContratoTitle_nuContrato}" required="true" requiredMessage="#{bundle.CreateContratoRequiredMessage_nuContrato}"/>
                                </p:column>
                                <p:column>
                                    <p:outputLabel value="#{bundle.CreateContratoLabel_vlContrato}" for="vlContrato" />
                                    <p:inputText id="vlContrato" value="#{contratoController.selected.vlContrato}" title="#{bundle.CreateContratoTitle_vlContrato}" required="true" requiredMessage="#{bundle.CreateContratoRequiredMessage_vlContrato}"/>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <p:outputLabel value="#{bundle.CreateContratoLabel_dtInicioVigencia}" for="dtInicioVigencia" />
                                    <p:calendar id="dtInicioVigencia" pattern="MM/dd/yyyy" value="#{contratoController.selected.dtInicioVigencia}" title="#{bundle.EditContratoTitle_dtInicioVigencia}" required="true" requiredMessage="#{bundle.EditContratoRequiredMessage_dtInicioVigencia}" showOn="button"/>
                                </p:column>
                                <p:column>
                                    <p:outputLabel value="#{bundle.CreateContratoLabel_dtFimVigencia}" for="dtFimVigencia" />
                                    <p:calendar id="dtFimVigencia" pattern="MM/dd/yyyy" value="#{contratoController.selected.dtFimVigencia}" title="#{bundle.EditContratoTitle_dtFimVigencia}" required="true" requiredMessage="#{bundle.EditContratoRequiredMessage_dtFimVigencia}" showOn="button"/>
                                </p:column>
                            </p:row>
                            <p:row>
                                <p:column>
                                    <p:outputLabel value="#{bundle.CreateContratoLabel_codParteContratada}" for="codParteContratada" />
                                    <p:selectOneMenu id="codParteContratada" value="#{contratoController.selected.codParteContratada}" required="true" requiredMessage="#{bundle.EditContratoRequiredMessage_codParteContratada}">
                                        <f:selectItems value="#{parteContratadaController.itemsAvailableSelectOne}"
                                                       var="codParteContratadaItem"
                                                       itemValue="#{codParteContratadaItem}"/>
                                    </p:selectOneMenu>
                                </p:column>
                            </p:row>
                        </p:panelGrid>
                        <p:commandButton actionListener="#{contratoController.update}" value="#{bundle.Save}" update="display,:ContratoListForm:datalist,:growl" oncomplete="handleSubmit(args, 'ContratoEditDialog');"/>
                        <p:commandButton value="#{bundle.Cancel}" onclick="ContratoEditDialog.hide()"/>
                    </h:panelGroup>
                </p:tab>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
